Ext.define('App.activiti.task.view.TaskList', {
    extend: 'Extend.grid.CrudGridPanel',
    alias: 'widget.TaskList',
    requires: ['App.activiti.task.model.TaskViewModel'],
    viewModel: 'TaskViewModel',
    config: {
        tbar: {
            quickCreate: {
                hidden: true
            }
        }
    },
    bind: {
        store: '{Query}',
        columns: '{columns}',
        search: '{search}'
    },
    editHandler: function (record, quickCreate, data) {
        var me = this;
        if (me.editor) {
            var opts = Ext.apply({
                targetGrid: me,
                url: me.editor.save || me.editor.submit,
                window: {},
                model: me.editor.model || 'Ext.data.Model',
                quickCreate: quickCreate
            }, me.editor)
            if (!Ext.isEmpty(me.editor.width)) {
                opts.window.width = me.editor.width
            }
            if (!Ext.isEmpty(me.editor.height)) {
                opts.window.height = me.editor.height
            }
            var editor = Ext.create(
                me.editor.formClass || me.editor.formClazz, opts)
                .show();
            editor.loadRecord(record);
        }
    },
    editor: {
        formClazz: 'App.activiti.task.view.TaskEditor',
        save: 'management/activiti/task/audit',
        get: 'management/activiti/task/get_by_id'
    }
});